/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Factory;

import javax.swing.JOptionPane;
import ucm.Controller.UCLogin_Controller;
import ucm.View.MainUI_View;
import ucm.View.UCAdmin_View;
import ucm.View.UCManager_View;

/**
 *
 * @author Administrator
 */
public class ShowInfoFactory {
    private ShowInfoFactory m_Factory = null;
    void Inti()
    {

    }
    public ShowInfoFactory Instance()
    {
        if(m_Factory == null)
        {
            m_Factory = new ShowInfoFactory();
        }
        return m_Factory;
    }
    public void CreateUI(int type, UCLogin_Controller con)
    {
        switch(type)
        {
            case 0:
            if ( con.run() )
            {
                JOptionPane.showMessageDialog(null, "Login ok");
                MainUI_View Myui = new MainUI_View(con.getName());
                Myui.setVisible(true);
            }
                break;
            case 1:
            if ( con.runManager() )
            {
                JOptionPane.showMessageDialog(null, "Login ok");
                UCManager_View Myui = new UCManager_View();
                Myui.setVisible(true);
            }
                break;
            case 2:
            if ( con.runadmin() )
            {
                JOptionPane.showMessageDialog(null, "Login ok");
                UCAdmin_View Myui = new UCAdmin_View();
                Myui.setVisible(true);
            }
                break;
        }

    }

}
